package org.opens.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.opens.entity.Student;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @Date 2020/12/30 21:15
 * @Created by 99126
 */
@Mapper
@Component
public interface StudentDao extends BaseMapper<Student> {

    List<Student> findByCondition(@Param(value = "student") Student student);

    int dynamicUpdate(@Param(value = "student") Student student);

    List<Student> chooseSelect(@Param(value = "student") Student student);

    /**
     * 说明：
     * <p>使用foreach遍历集合</p>
     */
    List<Student> findByIds(@Param(value = "ids") Collection<Integer> ids);

    /**
     * 说明：
     * <p>使用map传参</p>
     */
    int insertUseMap(@Param(value = "pm") Map<String, Object> param);

    int batchUpdate(@Param(value = "studentList") Collection<Student> students);

    int batchUpdateFromMysql(@Param(value = "studentList") Collection<Student> students);

    Student findByIdInc(@Param(value = "id") int id);

}
